package com.cloud.school.app.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.util.StringUtils;

/**
 * Created by enHui.Chen on 2019/1/27.
 */
@ApiModel("提问信息扩展对象")
public class QuestionEngineModel extends QuestionModel {
    @ApiModelProperty("新回答总数")
    private int newAnswerCount;

    public int getNewAnswerCount() {
        return newAnswerCount;
    }

    public void setNewAnswerCount(int newAnswerCount) {
        this.newAnswerCount = newAnswerCount;
    }

    public void setNewAnswerCount(String newAnswerCount) {
        if (StringUtils.isEmpty(newAnswerCount)) {
            this.newAnswerCount = 0;
        } else {
            this.newAnswerCount = Integer.valueOf(newAnswerCount);
        }
    }

    public QuestionEngineModel() {
    }

    public QuestionEngineModel(QuestionModel questionModel) {
        setId(questionModel.getId());
        setContent(questionModel.getContent());
        setImages(questionModel.getImages());
        setImageModels(questionModel.getImageModels());
        setCreateUid(questionModel.getCreateUid());
        setCreator(questionModel.getCreator());
        setCreateTime(questionModel.getCreateTime());
        setAnswerModels(questionModel.getAnswerModels());
        setAnswerCount(questionModel.getAnswerCount());
    }
}
